package com.ninjas.module.common.result;

import lombok.Data;
import org.springframework.http.HttpStatus;

@Data
public class Result {

    private Integer code;
    private String msg;
    private Object data;

    public static Result success() {
        return success(null);
    }

    public static Result success(Object object) {
        Result result = new Result();
        result.data = object;
        result.code = HttpStatus.OK.value();
        result.msg = "success";
        return result;
    }

    public static Result error(String msg) {
        Result result = new Result();
        result.msg = msg;
        result.code = HttpStatus.INTERNAL_SERVER_ERROR.value();
        return result;
    }
}
